﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CDSBDemandControl.Model;

namespace CDSBDemandControl.View.Web.PaginasInternas
{
    public partial class ScenarioDetail : System.Web.UI.Page
    {
        public DemandModel current;
        protected void Page_Load(object sender, EventArgs e)
        {
            List<DemandModel> solicitacoes = (List<DemandModel>)Session["scenarios"];
            current = solicitacoes.Find(delegate(DemandModel md) { return md.ID == Session["scenarioID"].ToString(); });            
        }

        public string showString(object data)
        {
            string aux = string.Empty;
            return (data != null && !string.IsNullOrEmpty(aux = data.ToString())) ? aux : "Não Informado";
        }

        public string showInt32(object data)
        {
            return (data != null) ? "" + Int32.Parse(data.ToString()) : "Não Informado";
        }

        public string showDateTime(object data)
        {
            DateTime aux;
            return (data != null && (aux = DateTime.Parse(data.ToString())) != DateTime.MinValue) ? "" + DateTime.Parse(data.ToString()).ToShortDateString() : "Não Informado";
        }

        public string showComplexity(object data)
        {
            return (data != null) ? "" + data.ToString() : "Não Informado";
        }

        public string showBoolean(object data)
        {
            return (data != null) ? Boolean.Parse(data.ToString()) ? "Sim" : "Não" : "Não Informado";
        }
    }
}
